<template>
  <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
    <van-swipe-item v-for="item in listbanner" :key="item.bannerid">
      <img :src="item.img" />
    </van-swipe-item>
  </van-swipe>
</template>

<script>
export default {
  data() {
    return {
      listbanner: [],
    };
  },
  created() {
    this.getbanner();
  },
  methods: {
    getbanner() {
      this.$http({
        url: "banner/list",
      }).then((res) => {
        if (res.data.code === "200") {
          // console.log(res.data);
          this.listbanner = res.data.data;
        }
      });
    },
  },
};
</script>

<style scoped>
.my-swipe .van-swipe-item {
  color: #fff;
  font-size: 20px;
  line-height: 150px;
  text-align: center;
  background-color: #39a9ed;
  width: 80%;
  height: 300px;
}
.van-swipe-item img {
  width: 100%;
  height: 100%;
}
</style>